package cn.com.pc.content.dto;

import cn.com.pc.content.domain.Biz;
import cn.com.pc.content.domain.Site;
import cn.com.pc.content.domain.tag.TagGroup;
import lombok.Data;
import lombok.ToString;
import org.springframework.beans.BeanUtils;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.time.LocalDateTime;

@Data
@ToString
public class TagGroupDTO {
    private Long id;
    private Site site;
    private Biz biz;
    @NotBlank(message = "name不能为空")
    private String name;
    @NotNull(message = "description不能为空")
    private String description;
    @NotNull(message = "onShelve不能为空")
    private Boolean onShelve;
    private LocalDateTime createdAt;
    private LocalDateTime updatedAt;

    public static TagGroupDTO from(TagGroup tagGroup) {
        TagGroupDTO tagGroupDTO = new TagGroupDTO();
        BeanUtils.copyProperties(tagGroup, tagGroupDTO);
        return tagGroupDTO;
    }
}
